<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">


<f:loadBundle basename="properties.messages" var="msg" />

<h:head>

	<title>#{msg.inbox}</title>

</h:head>

<ui:composition template="/WEB-INF/template/templateSupervisor.xhtml">

	<ui:define name="content">
		<f:view locale="#{language.locale}">
			<h:body>

				<center>
					<div class="createMessage">

						<h2 align="center">#{msg.createMessage}</h2>

						<h:form rendered="#{messageController1.noOption}">
							<h3>#{msg.chooseOperation}</h3>
							<h:selectOneMenu id="type"
								value="#{messageController1.currentOption}" onchange="submit()"
								valueChangeListener="#{messageController1.getCurrentOptionChanged}">
								<f:selectItems id="operationSelected"
									value="#{messageController1.options}" />
							</h:selectOneMenu>
						</h:form>

						<h:form rendered="#{!messageController1.noOption}">
							<h:panelGroup
								rendered="#{messageController1.currentOption==msg.create_user}">
								<h3>#{msg.requestNewUserAccount}</h3>
								<h:panelGrid columns="2" border="0">
									<h:outputText value="#{msg.username}"></h:outputText>
									<h:inputText value="#{messageController1.userName}">
									</h:inputText>

									<h:outputText value="#{msg.email}: "></h:outputText>
									<h:inputText value="#{messageController1.eMail}">
									</h:inputText>
								</h:panelGrid>
								<br />
								<br />
								<h:commandButton class="selectRepositoryButton" value="OK"
									action="#{messageController1.validate}" />
								<h:commandButton class="selectRepositoryButton"
									value="#{msg.back}" action="#{messageController1.cancelS}"></h:commandButton>
							</h:panelGroup>

							<h:panelGroup
								rendered="#{messageController1.currentOption==msg.invalidate_user}">
								<h3>#{msg.requestInvalidateUser}</h3>
								<h:outputText
									rendered="#{messageController1.noUsersToInvalidate}"
									value="#{msg.noValidUsers}"></h:outputText>
									<br />
									<h:commandButton rendered="#{messageController1.noUsersToInvalidate}" class="selectRepositoryButton"
										value="#{msg.back}" action="#{messageController1.cancelS}"></h:commandButton>
								<h:panelGroup
									rendered="#{!messageController1.noUsersToInvalidate}">
									<h:selectOneMenu id="invalUser"
										value="#{messageController1.currentUserInv}"
										onchange="submit()"
										valueChangeListener="#{messageController1.getCurrentUserInvChanged}">
										<f:selectItems value="#{messageController1.usersToInvalidate}" />
									</h:selectOneMenu>
									<br />
									<br />
									<h:commandButton class="selectRepositoryButton" value="OK"
										action="#{messageController1.validate}" />
									<h:commandButton class="selectRepositoryButton"
										value="#{msg.back}" action="#{messageController1.cancelS}"></h:commandButton>
								</h:panelGroup>
							</h:panelGroup>

							<h:panelGroup
								rendered="#{messageController1.currentOption==msg.delete_repository}">
								<h3>#{msg.deleteRepository}</h3>
								<br />
								<h:commandButton class="selectRepositoryButton" value="OK"
									action="#{messageController1.validate}" />
								<h:commandButton class="selectRepositoryButton"
									value="#{msg.back}" action="#{messageController1.cancelS}"></h:commandButton>
							</h:panelGroup>

							<h:panelGroup
								rendered="#{messageController1.currentOption==msg.create_repository}">
								<h3>#{msg.createRepository}</h3>
								<h:outputText value="#{msg.repNameLabel}"></h:outputText>
								<h:inputText value="#{messageController1.newRepository}">
								</h:inputText>
								<br />
								<br />
								<h:commandButton class="selectRepositoryButton" value="OK"
									action="#{messageController1.validate}" />
								<h:commandButton class="selectRepositoryButton"
									value="#{msg.back}" action="#{messageController1.cancelS}"></h:commandButton>
							</h:panelGroup>
							<h:panelGroup
								rendered="#{messageController1.currentOption==msg.transfer_rights}">
								<h3>#{msg.transferRights}</h3>
								<h:outputText rendered="#{messageController1.noUsersRights}"
									value="#{msg.noUsersInRepo}"></h:outputText>
									<br />
								<h:commandButton rendered="#{messageController1.noUsersRights}"
									class="selectRepositoryButton" value="#{msg.back}"
									action="#{messageController1.cancelS}"></h:commandButton>

								<h:panelGroup rendered="#{!messageController1.noUsersRights}">
									<h:selectOneMenu id="rightsTransf"
										value="#{messageController1.currentUserRights}"
										onchange="submit()"
										valueChangeListener="#{messageController1.getCurrentUserRightsChanged}">
										<f:selectItems value="#{messageController1.usersRights}" />
									</h:selectOneMenu>
									<br />
									<br />
									<h:commandButton class="selectRepositoryButton" value="OK"
										action="#{messageController1.validate}" />
									<h:commandButton class="selectRepositoryButton"
										value="#{msg.back}" action="#{messageController1.cancelS}"></h:commandButton>
								</h:panelGroup>
							</h:panelGroup>
							<h:panelGroup
								rendered="#{messageController1.currentOption==msg.user_to_repository}">
								<h3>#{msg.addNewUserToRepository}</h3>
								<h:outputText rendered="#{messageController1.noUsersOut}"
									value="#{msg.noUsersAccess}"></h:outputText>
									<br />
								<h:commandButton rendered="#{messageController1.noUsersOut}" class="selectRepositoryButton"
										value="#{msg.back}" action="#{messageController1.cancelS}"></h:commandButton>	
								<h:panelGroup rendered="#{!messageController1.noUsersOut}">
									<h:selectOneMenu id="userToRep"
										value="#{messageController1.currentUser}" onchange="submit()"
										valueChangeListener="#{messageController1.getCurrentUserChanged}">
										<f:selectItems value="#{messageController1.usersOut}" />
									</h:selectOneMenu>
									<br />
									<br />
									<h:commandButton class="selectRepositoryButton" value="OK"
										action="#{messageController1.validate}" />
									<h:commandButton class="selectRepositoryButton"
										value="#{msg.back}" action="#{messageController1.cancelS}"></h:commandButton>
								</h:panelGroup>
							</h:panelGroup>

						</h:form>
						<center>
							<h:messages style="color:red"></h:messages>
						</center>


						<br />
					</div>
				</center>

			</h:body>
		</f:view>
	</ui:define>
</ui:composition>

</html>